package com.andreiamariei.tema6.entities;

import java.util.List;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.Table;

import com.andreiamariei.tema6.entities.commons.BaseEntity;

@Entity
@Table(name="Movies")
public class Movie extends BaseEntity{
	
	@Column(name="DENUMIRE")
	private String titlu;
	public String getTitlu() { return titlu; }
	public void setTitlu(String titlu) { this.titlu = titlu; }
	
	@Column(name="DURATA")
	private String durata;
	public String getDurata() { return durata; }
	public void setDurata(String durata) { this.durata = durata; }

	@Column(name="AN_LANSARE")
	private String anLansare;
	public String getAnLansare() { return anLansare; }
	public void setAnLansare(String anLansare) { this.anLansare = anLansare; }
	
	@ManyToMany
	@JoinTable(name="CATEGORY_MOVIE_MAPPINGS",
			joinColumns=@JoinColumn(name="MOVIE_ID",referencedColumnName="ID"),
			inverseJoinColumns=@JoinColumn(name="CATEGORY_ID", referencedColumnName="ID"))
	private List<Category> categories;
	public List<Category> getCategories() { return categories; }
	public void setCategories(List<Category> categories) { this.categories = categories; }
	
	@ManyToMany
	@JoinTable(name="ACTOR_MOVIE_MAPPINGS",
			joinColumns=@JoinColumn(name="MOVIE_ID",referencedColumnName="ID"),
			inverseJoinColumns=@JoinColumn(name="ACTOR_ID", referencedColumnName="ID"))
	private List<Actor> actors;
	public List<Actor> getActors() { return actors; }
	public void setActors(List<Actor> actors) { this.actors = actors; }
	
}
